// userPageB/pages/userStore/exchangeAssets/exchangeAssets.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    selAssets: {
      type: Object,
      value: [],
    },
    consumptionData: {
      type: Number,
      value: 0,
    },
    obtainData: {
      type: Object,
      value: {},
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    navList:[
      {id: '1',value: '我的券'},
      {id: '2',value: '我的积分'}
    ],
    currentNavtab: '1',
    obtainData:{},//获得
    obtainworth: '',
    consumptionNum: 0,//消耗
  },
  attached(){
    this.getobtain()
    console.log("obtainData",this.properties.obtainData)
  },
  /**
   * 组件的方法列表
   */
  methods: {
    getobtain(){
      var selAssets = this.properties.selAssets
      var consumptionNum = 0
      console.log("selAssets",selAssets)
      selAssets.map(item =>{
        consumptionNum = consumptionNum + item.number
      })
      
      this.setData({
        consumptionNum: consumptionNum
      })
    },
    tabClick(e){
      var id = e.currentTarget.dataset.id;
      console.log('id',id)
      this.setData({
        currentNavtab: id,
      })
    }
  }
})
